/*
 *  Created at 2011-12-06 21:53 GMT-03:00
 *  Author: Victor Williams Stafusa da Silva
 *  JSmartUnit
 */
package org.jsmartunit.invocations;

import java.lang.annotation.Annotation;
import java.lang.reflect.Method;

import org.jsmartunit.model.TestRunner;

import org.junit.runners.model.InitializationError;

/**
 * @author Victor Williams Stafusa da Silva
 */
public class StaticMethodInvocationArgumentBuilder {

    private final Method method;

    public StaticMethodInvocationArgumentBuilder(Method method) {
        this.method = method;
    }

    public Method getMethod() {
        return method;
    }

    public Annotation[] getAnnotations() {
        return method.getAnnotations();
    }

    public <E extends Annotation> E getAnnotation(Class<E> annotationClass) {
        return method.getAnnotation(annotationClass);
    }

    public boolean isAnnotationPresent(Class<? extends Annotation> annotationClass) {
        return method.isAnnotationPresent(annotationClass);
    }

    public Class<?>[] getParameterTypes() {
        return method.getParameterTypes();
    }

    public TestRunner createRunner(TestRunner parentRunner, String name, Object[] args) throws InitializationError {
        return new StaticMethodInvocation(getMethod(), args).createRunner(parentRunner, name);
    }
}
